<? $page_title='汇总采购需求' ?>
<? include "FASHION/page_header.phtml" ?>

<form action="<? url('procsum-save') ?>" method="post" id="form1">

<table border="0" class="list"><tbody>
<tr class="nobg">
	<th><input type="checkbox" onclick="$('table[class=list] input[name^=demand]').attr('checked', $(this).attr('checked'))" /></th>
	<th>单号</th>
	<th>部门</th>
	<th>用户</th>
	<th>审批状态</th>
	<th>采购类型</th>
	<th>总数量</th>
	<th>时间</th>
	<th>操作</th>
</tr>
<{if $list}>
<? foreach($list as $d){ ?>
<tr>
	<td><input type="checkbox" name="demand[]" value="<{$d.id}>" /></td>
	<td><?$d.sno?></td>
	<td><?$d.dept_name?></td>
	<td><?$d.user_name?></td>
	<td class="state"><?= DemandHelper::flow2text($d.audit_flow) ?></td>
	<td class="state"><?= DemandHelper::type2text($d.type) ?></td>
	<td><div class="decimal"><{$d.amount}></div></td>
	<td class="nowrap"><?=date('Y/m/d H:i', $d.addtime)?></td>
	<td>
		<a href="<?url("proc-view/id/".$d.id)?>" class="view" title="查看"></a>
	</td>
</tr>
<? } ?>
<{/if}>
</tbody></table>

<br/>
<input type="submit" value="生成需求汇总" onclick="return confirm('确认汇总?');" />

</form>

<script>
ajax_form({
	before:function(){
		if($('table[class=list] input[name^=demand]:checked').length<1){
			show_alert("请选择采购需求");
			return false;
		}
	},
	success:function(jsn){
		if(jsn.summary_id){
			g2('<? url('procsum-view/id/SUMID') ?>'.replace('SUMID',jsn.summary_id));
		}
		else{
			show_alert("操作已成功");
			location.reload();
		}
	}
});
</script>

<? include "FASHION/page_footer.phtml" ?>
